package edu.cibertec.action;

import java.util.ArrayList;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionSupport;


import edu.cibertec.bean.BeanExpedienteDTO;
import edu.cibertec.bean.BeanInformeCostoDTO;

import edu.cibertec.service.ExpedienteService;
import edu.cibertec.service.InformeCostoServise;
@ParentPackage(value = "CiberStudio")
public class InformeCostoAction extends ActionSupport{

	private static final long serialVersionUID = 1L;
	
	
	private BeanInformeCostoDTO informe;
	private ArrayList<BeanInformeCostoDTO>listainforme;
	private BeanExpedienteDTO expediente;
	private ArrayList<BeanExpedienteDTO>listaexpediente;
	
	
	ExpedienteService eser=new ExpedienteService();
	InformeCostoServise iser=new InformeCostoServise();
	
	
	@Action(value = "AListarFrmInforme", results = { @Result(name = "success", type = "json") })
	public String ListarFrmInforme() throws Exception {
	
		String var = "";
	
		if (informe.getIdexpediente()!="") {
			var = informe.getIdexpediente();
		}else{var="";}

		listainforme = iser.ListarInforme(var);
		
		return SUCCESS;
	}
	
	@Action(value = "AListadoExpe", results = { @Result(name = "success", type = "json") })
	public String ListadoExpe() throws Exception {
	
		String var = expediente.getIdexpediente();

		listaexpediente = eser.buscarExpediente(var);

		return SUCCESS;
	}
	
	@Action(value = "Agrabarinforme", results = { @Result(name = "success",type="json") })
	public String grabarinforme() throws Exception {

		
		BeanInformeCostoDTO obj=new BeanInformeCostoDTO();
//		obj.setIdrecibo(recibo.getIdrecibo());
		obj.setIdexpediente(informe.getIdexpediente());
		obj.setPreciototal(informe.getPreciototal());
		obj.setObservaciones(informe.getObservaciones());

		
		iser.registriarInforme(obj);

		return SUCCESS;
	}
	
	
	public BeanInformeCostoDTO getInforme() {
		return informe;
	}
	public void setInforme(BeanInformeCostoDTO informe) {
		this.informe = informe;
	}
	public ArrayList<BeanInformeCostoDTO> getListainforme() {
		return listainforme;
	}
	public void setListainforme(ArrayList<BeanInformeCostoDTO> listainforme) {
		this.listainforme = listainforme;
	}



	public BeanExpedienteDTO getExpediente() {
		return expediente;
	}



	public void setExpediente(BeanExpedienteDTO expediente) {
		this.expediente = expediente;
	}



	public ArrayList<BeanExpedienteDTO> getListaexpediente() {
		return listaexpediente;
	}



	public void setListaexpediente(ArrayList<BeanExpedienteDTO> listaexpediente) {
		this.listaexpediente = listaexpediente;
	}
	
	
	
	

}
